<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="../common/common.jsp"%>
<title>卡密商品修改</title>
</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form" action="" method="post">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>渠道：</label>
            <div class="formControls col-xs-8 col-sm-8">
               <span class="select-box">
					<select id="channel" name="channel" class="select" required>
							<option value="SALE">售卖</option>
							<option value="EXCHANGE">兑换</option>
					</select>
				</span>
            </div>
        </div>
       <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属分类：</label>
            <div class="formControls col-xs-8 col-sm-8">
               <span class="select-box">
					<select id="kaMiCategoryId" name="kaMiCategoryId" class="select" required>
						<c:forEach items="${categoryList}" var="category">
							<option value="${category.id}">${category.name}</option>
						</c:forEach>
					</select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>名称：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.name}" placeholder="" id="name" name="name" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>成本：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.cost}" placeholder="" id="cost" name="cost" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所需兑换的积分：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.exchangePoint}" id="exchangePoint" name="exchangePoint" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>粉丝价：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.fansPrice}" id="fansPrice" name="fansPrice" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>会员价：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.baseVipPrice}" placeholder="" id="baseVipPrice" name="baseVipPrice" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>代理价：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.highVipPrice}" placeholder="" id="highVipPrice" name="highVipPrice" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级会员贝币分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.chiefBaseVipJinBi}" placeholder="" id="chiefBaseVipJinBi" name="chiefBaseVipJinBi" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级代理贝币分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.chiefHighVipJinBi}" placeholder="" id="chiefHighVipJinBi" name="chiefHighVipJinBi" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级会员积分分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.chiefBaseVipPoint}" placeholder="" id="chiefBaseVipPoint" name="chiefBaseVipPoint" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级代理积分分成：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.chiefHighVipPoint}" placeholder="" id="chiefHighVipPoint" name="chiefHighVipPoint" required="true">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>发送方式：</label>
            <div class="formControls col-xs-8 col-sm-8">
               <span class="select-box">
					<select id="sendType" name="sendType" class="select" required>
						<option value="SYSTEM">系统发送</option>
						<option value="HAND">手动发送</option>
					</select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>描述：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.description}" placeholder="" id="description" name="description">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">使用说明：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.remark}" placeholder="" id="remark" name="remark" >
            </div>
        </div>
         <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">订单备注提示信息：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="${kaMiProduct.orderRemarkTip}" placeholder="" id="orderRemarkTip" name="orderRemarkTip" >
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-8 col-xs-offset-4 col-sm-offset-3">
                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
            </div>
        </div>
    </form>
</article>

<script type="text/javascript">
$(document).ready(function () {
	 var id = "${kaMiProductId}";
	 $('#form').bind('submit', function () {
			var kaMiCategoryId = $("#kaMiCategoryId").val();
			var name = $("#name").val();
			var cost = $("#cost").val();
			var fansPrice = $("#fansPrice").val();
			var baseVipPrice = $("#baseVipPrice").val();
			var highVipPrice = $("#highVipPrice").val();
			var chiefBaseVipJinBi = $("#chiefBaseVipJinBi").val();
			var chiefHighVipJinBi = $("#chiefHighVipJinBi").val();
			var chiefBaseVipPoint = $("#chiefBaseVipPoint").val();
			var chiefHighVipPoint = $("#chiefHighVipPoint").val();
			var description = $("#description").val();
			var sendType = $("#sendType").val();
			var remark = $("#remark").val();
			var channel = $("#channel").val();
			var exchangePoint = $("#exchangePoint").val();
			var orderRemarkTip = $("#orderRemarkTip").val();

		$.ajax({
			type : 'POST',
			url : ctx + '/productManage/updateKamiProduct.do',
			data : {
				id : id,
				kaMiCategoryId : kaMiCategoryId,
				name : name,
				cost : cost,
				fansPrice : fansPrice,
				baseVipPrice : baseVipPrice,
				highVipPrice : highVipPrice,
				chiefBaseVipJinBi : chiefBaseVipJinBi,
				chiefHighVipJinBi : chiefHighVipJinBi,
				chiefBaseVipPoint : chiefBaseVipPoint,
				chiefHighVipPoint : chiefHighVipPoint,
				highVipPrice : highVipPrice,
				description : description,
				sendType : sendType,
				remark : remark,
				orderRemarkTip : orderRemarkTip,
				channel : channel,
				exchangePoint : exchangePoint
			},
			dataType : 'json',
			timeout : 30000,
			context : $('body'),
			success : function(data) {
				if (data.code == "ok") {
                   layer.msg("保存成功!", {icon: 6, time: 1000}, function () {
                   	layer_close();
                   });
				} else {
					 layer.msg(data.msg, {icon: 5, time: 2000});
				}
			},
			error : function(xhr, type) {
				layer.msg('保存失败!', {icon: 5, time: 2000});
			}
		});
		  return false;
	 });
});
</script>
</body>
</html>